{% extends '../../../layout/admin-base.html' %}
<script src="{{ assets_path("js/base.js")}}"></script>
{% block page %}
<h3 class="page-title">
    报修记录信息 <small>列表</small>
</h3>
<ul class="breadcrumb">
    <li>
        <i class="icon-home"></i>
        <a href="index.html">基本信息管理</a> 
        <i class="icon-angle-right"></i>
    </li>
    <li>
        <a href="{{url('admin/user/student')}}">报修记录信息管理</a>
        <i class="icon-angle-right"></i>
    </li>
    <li><span>列表</span></li>
</ul>
{% end%}
{% block content %}

<div class="row-fluid">
    <div class="span12">
        <div class="portlet box red">
            <div class="portlet-title">
                <div class="caption"><i class="icon-search"></i>搜索条件</div>
                <div class="tools">
                    <a href="javascript:;" class="collapse"></a>
                </div>
            </div>
            <div class="portlet-body form">
                <!-- BEGIN FORM-->
                <form action="{{url('admin/repair/log/search/')}}" class="horizontal-form">
                    <div class="row-fluid">
                        <div class="span4">
                            <div class="control-group">
                                <label class="control-label" for="studentName">报修人</label>
                                <div class="controls">
                                    <input type="text" id="studentName" name="studentName" class="m-wrap span12" placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="span4">
                            <div class="control-group">
                                <label class="control-label" for="tel">手机号</label>
                                <div class="controls">
                                    <input type="text" id="tel" name="tel" class="m-wrap span12" placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="span4">
                            <div class="control-group">
                                <label class="control-label" for="repairmanName">维修人</label>
                                <div class="controls">
                                    <input type="text" id="repairmanName" name="repairmanName" class="m-wrap span12" placeholder="">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row-fluid">
                        <div class="span4">
                            <div class="control-group">
                                <label class="control-label">维修类型</label>
                                <div class="controls">
                                    <select class="span12 m-wrap"  id="workType" name="workType">
                                        <option value="">全部</option>
                                        {%for key in itype%}
                                            {% if key ==  where.get('Ftype')%}
                                            <option value="{{key}}" selected="selected">{{itype[key]}}</option>
                                            {%else%}
                                            <option value="{{key}}">{{itype[key]}}</option>
                                            {%end%}
                                        {%end %}
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="span4">
                            <div class="control-group">
                                <label class="control-label">处理状态</label>
                                <div class="controls">
                                    <select class="m-wrap span12" id="status" name="status">
                                        <option value="1">未处理</option>
                                        <option value="2">处理中</option>
                                        <option value="3">已处理</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="span4">
                            <div class="control-group">
                                <label class="control-label" for="dormNo">宿舍楼</label>
                                <div class="controls">
                                    <select class="span12 m-wrap"  id="dormNo" name="dormNo">
                                        <option value=""></option>
                                        {% for i in drom %}
                                            <option value="{{ i['Fid'] }}" {% if i["Fid"]==where.get("Fdorm_id", '') %}selected='selected'{% end %}>{{ i['Fdorm_name'] }}</option>
                                        {% end %}
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--/row-->
                    <div class="form-actions">
                        <button type="submit" class="btn blue"><i class="icon-search"></i>搜索</button>
                        <button type="button" class="btn">清空</button>
                    </div>
                </form>
                <!-- END FORM--> 
            </div>
        </div>
        <!-- BEGIN EXAMPLE TABLE PORTLET-->
        <div class="portlet box light-grey">
            <div class="portlet-title">
                <div class="caption"><i class="icon-list"></i>报修记录列表</div>
                <div class="tools">
                    <a href="javascript:;" class="collapse"></a>
                    <a href="#portlet-config" data-toggle="modal" class="config"></a>
                    <a href="javascript:;" class="reload"></a>
                    <!-- <a href="javascript:;" class="remove"></a> -->
                </div>
            </div>
            <div class="portlet-body">
                <div class="clearfix">
                    <div class="btn-group">
                        <!-- <a id="sample_editable_1_new" class="btn green" href="{{url('admin/repair/log/new')}}">
                        已处理<i class="icon-plus"></i>
                        </a> -->
                    </div>
                    <div class="btn-group pull-right">
                        <button class="btn dropdown-toggle" data-toggle="dropdown">工具<i class="icon-angle-down"></i>
                        </button>
                        <ul class="dropdown-menu pull-right">
                            <li><a href="#">打印</a></li>
                            <li><a href="#">另存为PDF</a></li>
                            <li><a href="#">另存为Excel</a></li>
                        </ul>
                    </div>
                </div>
                <table class="table table-striped table-bordered table-hover" id="sample_1">
                    <thead>
                        <tr>
                            <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" /></th>
                            <th>报修时间</th>
                            <th class="hidden-300">报修人</th>
                            <th class="hidden-240">手机号</th>
                            <th class="hidden-300">类型</th>
                            <th class="hidden-300">报修设备</th>
                            <th class="hidden-480">维修负责人</th>
                            <th class="hidden-200">地址</th>
                            <th class="hidden-200">是否处理</th>
                            <th ></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for i in data %}
                        <tr class="odd gradeX">
                            <td><input type="checkbox" class="checkboxes" value="1" /></td>
                            <td>{{ stamp_2_time(i["Fcreate_time"]) }}</td>
                            <td>{{ i["Fuser_name"] }}</td>
                            <td>{{ i["Fuser_phone"] }}</td>
                            <td>{{ itype[i["Fdevice_type_id"]] }}</td>
                            <td>{{ i["Fdevice_name"] }}</td>
                            <input type="hidden" id="{{i['Frepair_id']}}" value="{{i['Frepair_id']}}">
                            <td class="hidden-100">{{ i["Frepair_name"] }}</td>
                            <td class="hidden-100">{{ i["Fdorm_name"] }}</td>
                            <td class="center hidden-100">
                                {% if i.get("Fstatus")=='1' %}
                                    <span class="label label-error">未处理</span>
                                {% elif i.get('Fstatus')=='2' %}
                                    <span class="label label-success">已分配</span>
                                {% else %}
                                    <span class="label label-success">已处理</span>
                                {% end %}
                            </td>
                            <td ><a class="btn mini purple" href="#ostack1" onclick="save('{{ i.get('Fid') }}')" data-toggle="modal"><i class="icon-edit"></i>分配维修人员</a>
                                <a class="btn mini black" href="/admin/repair/log/finish/?page={{ page_info['page'] }}&ids={{ i.get('Fid') }}">
                                    <i class="icon-trash"></i>完成
                                </a>
                            </td>
                        </tr>
                        {% end %}
                    </tbody>
                </table>
                {% module Paginate(page_info['total'], page_info['page']) %}
            </div>
        </div>
        <!-- END EXAMPLE TABLE PORTLET-->
<div id="ostack1" class="modal hide fade" tabindex="-1" data-focus-on="input:first">
   <div class="modal-header">
       <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
       <h3>分配维修人员</h3>
   </div>
   <div class="modal-body">
        <form method="post" action="/admin/repair/log/save/?page={{ page_info['page'] }}">
            <input type="hidden" value="" id="did" name="did">
            <select id="mainid" name="mainid">
            {% for i in repairman %}
                <option value="{{ i.get('Fid') }}">{{ i.get('Fname') }}</option>
            {% end %}
            </select>
            <input type="submit" class="btn green" value="确认分配" >
        </form>
   </div>
   <div class="modal-footer">
       <button type="button" data-dismiss="modal" class="btn">关闭</button>
       <!-- <button type="button" class="btn red"></button> -->
   </div>
</div>
    </div>
</div>
<script type="text/javascript">
    function save(t){
        $('#did').val(t)
    }
</script>
{% end%}